Optimal. Leaf size=180 \[ \frac {\left (8 a^3 A+12 a A b^2+12 a^2 b B+3 b^3 B\right ) \tanh ^{-1}(\sin (c+d x))}{8 d}+\frac {\left (16 a^2 A b+4 A b^3+3 a^3 B+12 a b^2 B\right ) \tan (c+d x)}{6 d}+\frac {b \left (20 a A b+6 a^2 B+9 b^2 B\right ) \sec (c+d x) \tan (c+d x)}{24 d}+\frac {(4 A b+3 a B) (a+b \sec (c+d x))^2 \tan (c+d x)}{12 d}+\frac {B (a+b \sec (c+d x))^3 \tan (c+d x)}{4 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.22, antiderivative size = 180, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {4087, 4082,
3872, 3855, 3852, 8} \begin {gather*} \frac {b \left (6 a^2 B+20 a A b+9 b^2 B\right ) \tan (c+d x) \sec (c+d x)}{24 d}+\frac {\left (3 a^3 B+16 a^2 A b+12 a b^2 B+4 A b^3\right ) \tan (c+d x)}{6 d}+\frac {\left (8 a^3 A+12 a^2 b B+12 a A b^2+3 b^3 B\right ) \tanh ^{-1}(\sin (c+d x))}{8 d}+\frac {(3 a B+4 A b) \tan (c+d x) (a+b \sec (c+d x))^2}{12 d}+\frac {B \tan (c+d x) (a+b \sec (c+d x))^3}{4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 3872
Rule 4082
Rule 4087
Rubi steps
\begin {align*} \int \sec (c+d x) (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx &=\frac {B (a+b \sec (c+d x))^3 \tan (c+d x)}{4 d}+\frac {1}{4} \int \sec (c+d x) (a+b \sec (c+d x))^2 (4 a A+3 b B+(4 A b+3 a B) \sec (c+d x)) \, dx\\ &=\frac {(4 A b+3 a B) (a+b \sec (c+d x))^2 \tan (c+d x)}{12 d}+\frac {B (a+b \sec (c+d x))^3 \tan (c+d x)}{4 d}+\frac {1}{12} \int \sec (c+d x) (a+b \sec (c+d x)) \left (12 a^2 A+8 A b^2+15 a b B+\left (20 a A b+6 a^2 B+9 b^2 B\right ) \sec (c+d x)\right ) \, dx\\ &=\frac {b \left (20 a A b+6 a^2 B+9 b^2 B\right ) \sec (c+d x) \tan (c+d x)}{24 d}+\frac {(4 A b+3 a B) (a+b \sec (c+d x))^2 \tan (c+d x)}{12 d}+\frac {B (a+b \sec (c+d x))^3 \tan (c+d x)}{4 d}+\frac {1}{24} \int \sec (c+d x) \left (3 \left (8 a^3 A+12 a A b^2+12 a^2 b B+3 b^3 B\right )+4 \left (16 a^2 A b+4 A b^3+3 a^3 B+12 a b^2 B\right ) \sec (c+d x)\right ) \, dx\\ &=\frac {b \left (20 a A b+6 a^2 B+9 b^2 B\right ) \sec (c+d x) \tan (c+d x)}{24 d}+\frac {(4 A b+3 a B) (a+b \sec (c+d x))^2 \tan (c+d x)}{12 d}+\frac {B (a+b \sec (c+d x))^3 \tan (c+d x)}{4 d}+\frac {1}{6} \left (16 a^2 A b+4 A b^3+3 a^3 B+12 a b^2 B\right ) \int \sec ^2(c+d x) \, dx+\frac {1}{8} \left (8 a^3 A+12 a A b^2+12 a^2 b B+3 b^3 B\right ) \int \sec (c+d x) \, dx\\ &=\frac {\left (8 a^3 A+12 a A b^2+12 a^2 b B+3 b^3 B\right ) \tanh ^{-1}(\sin (c+d x))}{8 d}+\frac {b \left (20 a A b+6 a^2 B+9 b^2 B\right ) \sec (c+d x) \tan (c+d x)}{24 d}+\frac {(4 A b+3 a B) (a+b \sec (c+d x))^2 \tan (c+d x)}{12 d}+\frac {B (a+b \sec (c+d x))^3 \tan (c+d x)}{4 d}-\frac {\left (16 a^2 A b+4 A b^3+3 a^3 B+12 a b^2 B\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{6 d}\\ &=\frac {\left (8 a^3 A+12 a A b^2+12 a^2 b B+3 b^3 B\right ) \tanh ^{-1}(\sin (c+d x))}{8 d}+\frac {\left (16 a^2 A b+4 A b^3+3 a^3 B+12 a b^2 B\right ) \tan (c+d x)}{6 d}+\frac {b \left (20 a A b+6 a^2 B+9 b^2 B\right ) \sec (c+d x) \tan (c+d x)}{24 d}+\frac {(4 A b+3 a B) (a+b \sec (c+d x))^2 \tan (c+d x)}{12 d}+\frac {B (a+b \sec (c+d x))^3 \tan (c+d x)}{4 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.95, size = 140, normalized size = 0.78 \begin {gather*} \frac {3 \left (8 a^3 A+12 a A b^2+12 a^2 b B+3 b^3 B\right ) \tanh ^{-1}(\sin (c+d x))+\tan (c+d x) \left (24 \left (3 a^2 A b+A b^3+a^3 B+3 a b^2 B\right )+9 b \left (4 a A b+4 a^2 B+b^2 B\right ) \sec (c+d x)+6 b^3 B \sec ^3(c+d x)+8 b^2 (A b+3 a B) \tan ^2(c+d x)\right )}{24 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.46, size = 223, normalized size = 1.24 Too large to display
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 266, normalized size = 1.48 \begin {gather*} \frac {48 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} B a b^{2} + 16 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} A b^{3} - 3 \, B b^{3} {\left (\frac {2 \, {\left (3 \, \sin \left (d x + c\right )^{3} - 5 \, \sin \left (d x + c\right )\right )}}{\sin \left (d x + c\right )^{4} - 2 \, \sin \left (d x + c\right )^{2} + 1} - 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 36 \, B a^{2} b {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 36 \, A a b^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 48 \, A a^{3} \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 48 \, B a^{3} \tan \left (d x + c\right ) + 144 \, A a^{2} b \tan \left (d x + c\right )}{48 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.54, size = 211, normalized size = 1.17 \begin {gather*} \frac {3 \, {\left (8 \, A a^{3} + 12 \, B a^{2} b + 12 \, A a b^{2} + 3 \, B b^{3}\right )} \cos \left (d x + c\right )^{4} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (8 \, A a^{3} + 12 \, B a^{2} b + 12 \, A a b^{2} + 3 \, B b^{3}\right )} \cos \left (d x + c\right )^{4} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (6 \, B b^{3} + 8 \, {\left (3 \, B a^{3} + 9 \, A a^{2} b + 6 \, B a b^{2} + 2 \, A b^{3}\right )} \cos \left (d x + c\right )^{3} + 9 \, {\left (4 \, B a^{2} b + 4 \, A a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )^{2} + 8 \, {\left (3 \, B a b^{2} + A b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{48 \, d \cos \left (d x + c\right )^{4}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (A + B \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{3} \sec {\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 586 vs.
\(2 (170) = 340\).
time = 0.53, size = 586, normalized size = 3.26 \begin {gather*} \frac {3 \, {\left (8 \, A a^{3} + 12 \, B a^{2} b + 12 \, A a b^{2} + 3 \, B b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (8 \, A a^{3} + 12 \, B a^{2} b + 12 \, A a b^{2} + 3 \, B b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (24 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 72 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 36 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 36 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 72 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 24 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 15 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 72 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 216 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 36 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 36 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 120 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 40 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 9 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 72 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 216 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 36 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 36 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 120 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 40 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 9 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 24 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 72 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 36 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 36 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 72 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 24 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 15 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{4}}}{24 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.01, size = 395, normalized size = 2.19 \begin {gather*} \frac {\mathrm {atanh}\left (\frac {4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A\,a^3+\frac {3\,B\,a^2\,b}{2}+\frac {3\,A\,a\,b^2}{2}+\frac {3\,B\,b^3}{8}\right )}{4\,A\,a^3+6\,B\,a^2\,b+6\,A\,a\,b^2+\frac {3\,B\,b^3}{2}}\right )\,\left (2\,A\,a^3+3\,B\,a^2\,b+3\,A\,a\,b^2+\frac {3\,B\,b^3}{4}\right )}{d}-\frac {\left (2\,A\,b^3+2\,B\,a^3-\frac {5\,B\,b^3}{4}-3\,A\,a\,b^2+6\,A\,a^2\,b+6\,B\,a\,b^2-3\,B\,a^2\,b\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+\left (3\,A\,a\,b^2-6\,B\,a^3-\frac {3\,B\,b^3}{4}-\frac {10\,A\,b^3}{3}-18\,A\,a^2\,b-10\,B\,a\,b^2+3\,B\,a^2\,b\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (\frac {10\,A\,b^3}{3}+6\,B\,a^3-\frac {3\,B\,b^3}{4}+3\,A\,a\,b^2+18\,A\,a^2\,b+10\,B\,a\,b^2+3\,B\,a^2\,b\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (-2\,A\,b^3-2\,B\,a^3-\frac {5\,B\,b^3}{4}-3\,A\,a\,b^2-6\,A\,a^2\,b-6\,B\,a\,b^2-3\,B\,a^2\,b\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8-4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+6\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________